package edu.gdkm.web.controller;

import edu.gdkm.service.iface.UserService;
import edu.gdkm.sql.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/home")
@CrossOrigin
@ResponseBody
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("/login")
    public User login(@RequestBody User user) {
        User usersql = userService.findByUsername(user.getUsername());
        System.out.println(usersql);
        return usersql;
    }

}
